package com.hp.tiger.concurrent.classloader.chapter3;

/**
 * @author XavierDong
 **/

/**
 *
 * 1.父类加载的委托是优先交给父加载器去尝试加载
 *
 * 2.父加载器和子加载器其实是一种包装关系，或者包含关系
 *
 *
 */
public class MyClassloaderTest2
{

    public static void main(String[] args) throws ClassNotFoundException {
        MyClassLoader myClassLoader1 = new MyClassLoader("MyClassLoader1");
        MyClassLoader myClassLoader2 = new MyClassLoader("MyClassLoader2",myClassLoader1);
        myClassLoader2.setDir("/Users/xavierdong/Documents/classloader2");

        Class<?> aClass = myClassLoader2.loadClass("com.hp.tiger.concurrent.classloader.chapter3.MyObject");
        System.out.println(aClass);
        System.out.println(((MyClassLoader) aClass.getClassLoader()).getClassLoaderName());

    }


}
